﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Phones.Client.Model;
using System.Collections.ObjectModel;
using Phones.Client.Repository;

namespace Phones.Client.Repository
{
    public class ServiceNodesRepository : BaseRepository<ServiceNode>, IDisposable
    {
        public ServiceNode GetByName(string name)
        {
            var node = Context.ServiceNodes.FirstOrDefault(x => x.Name == name);
            return node;                       
        }

        public override List<ServiceNode> GetList()
        {
            var query = from node in Context.ServiceNodes.Include("Cities") 
                        select node;
            var list = query.ToList();
            return list;
        }
    }
}
